﻿<UserControl xmlns:PageBar="clr-namespace:Mengsk.ProxyDelivery.App.UI.PageBar"  x:Class="Mengsk.ProxyDelivery.App.UI.Goods.GoodsUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="1400">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <StackPanel Grid.Row="0" Orientation="Horizontal" >
            <TextBlock Text="商品编号:" Margin="3" VerticalAlignment="Center"></TextBlock>
            <TextBox Name="tbId" Margin="3" VerticalAlignment="Center" Width="100"/>
            <TextBlock Text="厂家名称:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Name="tbVendorName" Margin="3" VerticalAlignment="Center" Width="100" />
            <TextBlock Text="商品货号:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Name="tbNumber" Margin="3" VerticalAlignment="Center" Width="100"/>
            <TextBlock Text="商品类型:" Margin="3" VerticalAlignment="Center"/>
            <ComboBox Name="cbbTypes" Margin="3" VerticalAlignment="Center" Width="100">
                <ComboBoxItem>所有</ComboBoxItem>
                <ComboBoxItem>凉鞋</ComboBoxItem>
                <ComboBoxItem>低帮鞋</ComboBoxItem>
                <ComboBoxItem>拖鞋</ComboBoxItem>
                <ComboBoxItem>高帮鞋</ComboBoxItem>
                <ComboBoxItem>靴子</ComboBoxItem>
                <ComboBoxItem>男鞋</ComboBoxItem>
                <ComboBoxItem>凡布鞋</ComboBoxItem>
                <ComboBoxItem>雨鞋</ComboBoxItem>
                <ComboBox.SelectedIndex>0</ComboBox.SelectedIndex>
            </ComboBox>
            <Button Name="btnSearch" Content="查询" Margin="3" VerticalAlignment="Center" Width="60" Click="btnSearch_Click"/>
            <Button Name="btnAdd" Content="添加" Margin="3" VerticalAlignment="Center" Width="60" Click="btnAdd_Click"/>
            <Button Name="btnUpdate" Content="更新" Margin="3" VerticalAlignment="Center" Width="60" Click="btnUpdate_Click"/>
            <Button Name="btnEdit" Content="编辑" Margin="3" VerticalAlignment="Center" Width="60" Click="btnEdit_Click"/>
            <Button Name="btnEditSku" Content="编辑SKU" Margin="3" VerticalAlignment="Center" Width="60" Click="btnEditSku_Click"/>
            <Button Name="btnEnable" Content="上架/下架" Margin="3" VerticalAlignment="Center" Width="80" Click="btnEnable_Click"/>
        </StackPanel>
        
        <DataGrid Grid.Row="1" AutoGenerateColumns="False" IsReadOnly="True" GridLinesVisibility="All" Name="dgvShoes">
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="图片" Width="Auto">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate >
                            <Image Width="60" Height="60" Source="{Binding Image,Converter={StaticResource webUrlImageConverter}}"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="商品编号" Binding="{Binding Id}"/>
                <DataGridTextColumn Header="厂家名称(拼音)" Binding="{Binding VendorId,Converter={StaticResource vendorConverter}}"/>
                <DataGridTextColumn Header="鞋子类型" Binding="{Binding Type, Converter={StaticResource ResourceKey=descriptionConverter}}"/>
                <DataGridTextColumn Header="产品货号" Binding="{Binding Number}"/>
                <DataGridTextColumn Header="GO2价格" Binding="{Binding Price}"/>
                <DataGridTextColumn Header="产品重量" Binding="{Binding Weight}"/>
                <DataGridTextColumn Header="状态" Binding="{Binding Enabled,Converter={StaticResource boolConverter},ConverterParameter=已下架|出售中}"/>
                <DataGridTextColumn Header="允许网络更新" Binding="{Binding UpdateEnabled,Converter={StaticResource boolConverter},ConverterParameter=否|是}"/>
                <!--<DataGridTextColumn Header="版本信息" Binding="{Binding Skus,Converter={StaticResource shoesSkuEdtionConverter}}"/>-->
                <!--<DataGridTextColumn Header="颜色信息" Binding="{Binding Skus,Converter={StaticResource shoesSkuColorConverter}}"/>-->
                <!--<DataGridTextColumn Header="尺码信息" Binding="{Binding Skus,Converter={StaticResource shoesSkuSizeConverter}}"/>-->
                <DataGridTextColumn Header="创建时间" Binding="{Binding CreateTime,StringFormat=yyyy-MM-dd HH:mm:ss}"/>
                <DataGridTextColumn Header="更新时间" Binding="{Binding UpdateTime,StringFormat=yyyy-MM-dd HH:mm:ss}"/>
                <DataGridTextColumn Header="最后出售时间" Binding="{Binding LastSellTime,Converter={StaticResource datetimeConverter}}"/>
                <DataGridHyperlinkColumn Header="商品网址" Binding="{Binding Url}" Width="*">
                    <DataGridHyperlinkColumn.ElementStyle>
                        <Style>
                            <EventSetter Event="Hyperlink.Click" Handler="Open_Click"/>
                        </Style>
                    </DataGridHyperlinkColumn.ElementStyle>
                </DataGridHyperlinkColumn>
            </DataGrid.Columns>
        </DataGrid>
        <PageBar:PageBarUserControl Grid.Row="2" x:Name="pbBar" PageSize="50" PageChanging="pbBar_PageChanging" />
    </Grid>
</UserControl>
